/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: Administrator
 * Date: 2023-07-23
 * Time: 23:41
 */
public class Test8 {
    public static void main(String[] args) throws InterruptedException {
        Thread t = new Thread(() ->{
           while (!Thread.currentThread().isInterrupted()){
               System.out.println("hello thread");
               try {
                   Thread.sleep(3000);
               } catch (InterruptedException e) {
                   break;
               }
           }
        });

        t.start();
        Thread.sleep(3000);

        t.interrupt();
    }
}
